<?php

Loader::using("models::entities::Solicitudes");
Loader::using("models::entities::enums::EstadoSolicitud");

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of VerSolicitudesEmpresa
 *
 * @author boscaru
 * export-metadata RequiredRoles:ROLE_ENTERPRISE
 * 
 * @export Modules
 */
class VerSolicitudesEmpresa extends Module {
    
    public function index() {
        
        //$usuario= $this->currentUser->getName();
        //con usuario obtener el nit
        //$nit;
        
            $Solicitudes = array();
            $Solicitudes= $this->model->applications->GetByEmpresa('12123112');
            $empresa = new Empresas();
            $empresa = $this->model->companies->GetById('12123112');
            $NombreEmpresa = $empresa->getNombre();
            $this->assign("nombreEmpresa", $NombreEmpresa);
            $EstadoSolicitud = EstadoSolicitud::values();
            $this->assign("solicitudes", $Solicitudes);
            $this->assign("reportar", $this->route->moduleAction("ReportarAmonestacion", "index"));
            $this->assign("finalizar", $this->route->moduleAction("FinalizarPracticas", "index"));
            $this->assign("evaluar", $this->route->moduleAction("EvaluarCompetenciasPracticante", "index"));
            $this->assign("verSolicitud", $this->route->action("VerSolicitud"));
            $this->assign("verBitacora", $this->route->action("verBitacora"));
            $this->assign("estadosSolicitud", $EstadoSolicitud);
            $this->display("index");
       
    }
    
    public function VerSolicitud() {
        $id = $this->request->get("idSolicitud", NULL);
        if(is_numeric($id)){
            
            $solicitud = new Solicitudes();
            $solicitud = $this->model->applications->GetById($id);
          
            if(!is_null($solicitud->getPracticanteActual())){
            $solicitud->getPracticanteActual()->setEstudiante($this->model->students->GetById($solicitud->getPracticanteActual()->getCodigoEstudiante()));
            }
          
            $this->assign("solicitud", $solicitud);
            $this->assign("UrlVolver", $this->route->action("index"));
            $this->display(); 
        }else{
            $this->index();
        }
            
    }
    

    public function getSolicitud() {

        if (!$this->Solicitud) {
            $this->Solicitud = $this->model->applications->GetById($this->request->get("SolicitudId"));
            Loader::using("models::entities::Practicantes");
            $solicitud->setPracticanteActual(new Practicantes());
        }
        
        return $this->Solicitud;
    }
    
   
    
}

?>

